@theme-color: #a862ea;
@sub-color: #e7daff;
@text-color: #383838;
@bg-color: #ffffff;
@light-color: #f8f5ff;
@font-size: 15px;
@line-space: 12px;
@line-height: 2.5 * @line-space;
@monospace-font: Operator Mono, Consolas, Monaco, Menlo, monospace;
@font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell,
  'Open Sans', 'Helvetica Neue', sans-serif;

// @mixin hoverUnderLine {
//   position: relative;
//   &::after {
//     content: '';
//     position: absolute;
//     width: 98%;
//     height: 1px;
//     bottom: 0;
//     left: 0;
//     transform: scaleX(0);
//     background-color: @theme-color;
//     transform-origin: bottom right;
//     transition: transform 0.3s ease-in-out;
//   }

//   &:hover::after {
//     transform: scaleX(1);
//     transform-origin: bottom left;
//   }
// }

.markdown-body {
  color: @text-color;
  font-size: @font-size;
  line-height: @line-height;
  letter-spacing: 2px;
  word-break: break-word;
  font-family: @font-family;
  scroll-behavior: smooth;
  background-image: linear-gradient(
      0deg,
      transparent 24%,
      rgba(201, 195, 195, 0.329) 25%,
      rgba(209, 201, 201, 0.05) 26%,
      transparent 27%,
      transparent 74%,
      rgba(209, 204, 204, 0.185) 75%,
      rgba(180, 176, 176, 0.05) 76%,
      transparent 77%,
      transparent
    ),
    linear-gradient(
      90deg,
      transparent 24%,
      rgba(204, 196, 196, 0.226) 25%,
      rgba(172, 165, 165, 0.05) 26%,
      transparent 27%,
      transparent 74%,
      rgba(209, 204, 204, 0.185) 75%,
      rgba(180, 176, 176, 0.05) 76%,
      transparent 77%,
      transparent
    );
  background-color: @bg-color;
  background-size: 50px 50px;
  padding-bottom: 60px;

  ::selection {
    color: #fff;
    background-color: @theme-color;
  }

  h1,
  h2,
  h3,
  h4,
  h5,
  h6 {
    margin: @line-space * 2 0 @line-space 0;
    color: @theme-color;
  }

  h1 {
    line-height: 2;
    font-size: 1.4em;

    & ~ p:first-of-type::first-letter {
      color: @theme-color;
      float: left;
      font-size: 2em;
      margin-right: 0.4em;
      font-weight: bolder;
    }
  }

  h2 {
    font-size: 1.2em;
  }

  h3 {
    font-size: 1.1em;
  }

  ol,
  ul {
    padding-left: 2em;

    li {
      margin-bottom: 0;
      padding-left: 0.2em;

      &::marker {
        color: @theme-color;
      }

      &.task-list-item {
        list-style: none;

        ul,
        ol {
          margin-top: 0;
        }
      }
    }

    ul,
    ol {
      margin-top: 10px;
    }
  }

  p,
  li,
  code,
  h1,
  h2,
  h3,
  h4,
  h5,
  h6,
  a {
    opacity: 0.85;
    vertical-align: baseline;
    transition: all 0.1s ease;

    &:hover {
      opacity: 1;
    }
  }

  a {
    position: relative;
    display: inline-block;
    color: @theme-color;
    cursor: pointer;
    text-decoration: none;
    // @include hoverUnderLine();

    &:active,
    &:link {
      color: @theme-color;
    }
  }

  img {
    max-width: 100%;
    user-select: none;
    margin: 1em 0;
    transition: transform 0.2s ease 0s;
    background-color: @light-color;
    box-shadow: 0 0 10px @sub-color;

    &:hover {
      opacity: 1;
      box-shadow: 0 0 20px @sub-color;
      transform: translateY(-1px);
    }
  }

  blockquote {
    padding: 0.5em 1em;
    margin: @line-space 0;
    border-top-left-radius: 2px;
    border-bottom-left-radius: 2px;
    border-left: 3px solid @theme-color;
    background-color: @light-color;
    & > p {
      margin: 0;
    }
  }

  .math {
    font-style: italic;
    margin: @line-space 0;
    padding: 0.5em 1em;
    background-color: @light-color;
    & > p {
      margin: 0;
    }
  }

  // code {
  //   padding: 2px 0.4em;
  //   overflow-x: auto;
  //   color: @theme-color;
  //   font-weight: bold;
  //   word-break: break-word;
  //   font-family: @monospace-font;
  //   background-color: @light-color;
  // }

  // pre {
  //   margin: 2em 0;

  //   > code {
  //     display: block;
  //     padding: 1.5em;
  //     word-break: normal;
  //     font-size: 0.9em;
  //     font-style: normal;
  //     font-weight: normal;
  //     font-family: @monospace-font;
  //     line-height: 1.5 * @line-space;
  //     color: @text-color;
  //     border-radius: 2px;
  //     scroll-behavior: smooth;
  //     box-shadow: 0 0 10px @sub-color;

  //     &:hover {
  //       box-shadow: 0 0 20px @sub-color;
  //     }

  //     &::-webkit-scrollbar {
  //       height: 6px;
  //       background-color: @light-color;
  //     }

  //     &::-webkit-scrollbar-thumb {
  //       background-color: @sub-color;
  //       border-bottom-left-radius: 3px;
  //       border-bottom-right-radius: 3px;
  //     }
  //   }
  // }

  hr {
    margin: 2em 0;
    border-top: 1px solid @theme-color;
  }

  table {
    width: 100%;
    font-size: 12px;
    max-width: 100%;
    overflow: auto;
    border-collapse: collapse;
  }

  thead {
    color: @theme-color;
    background: @light-color;
  }

  td,
  th {
    padding: 0.5em;
    border: solid 1px @sub-color;
  }

  tr {
    background-color: @light-color;
  }
}

@media (max-width: 720px) {
  .markdown-body {
    font-size: 12px;
  }
}
